/**********************************************************************************
// Achievements Header File
// 
// Creation:	29 Jun 2011
// Updated:		06 Jul 2011
// Compiler:	Visual Studio 2010
//
// Notes:		Achievements manager for game
//
**********************************************************************************/

#ifndef _SPACERACEACHIEVEMENTS_H_
#define _SPACERACEACHIEVEMENTS_H_

#include "Sprite.h"
#include "Timer.h"

/**********************************************************************************/

#define NUMACHIEV 5

struct Achievement
{
	int points;
	char name[40];
	char description[80];
	bool unlocked;
}; 

enum AchievNames {TRACER, INSPECTOR, PEDAL, REDUNDANT, LEFTRIGHT};

/**********************************************************************************/

class Achievements
{
public:
	uint inspector;							// number of times inspector was used
	uint tracer;							// number of times the tracer was turned on
	bool pedal;								// pedal to metal
	bool redundantLeft;						// redundant left
	bool redundantRight;					// redundant right
	bool redundantL[5];						// redundant stages
	bool redundantR[5];						// redundant stages

private:
	Sprite * achievementIcons;				// achievement icons for the game
	Achievement achievementList[NUMACHIEV];	// list of achievements for the game
	Timer timer;							// show achievements for a short period

	uint  totalPoints;						// total number of points unlocked in the game
	float animDelay;						// duration of achievement animation
	int   lastIndex;						// index of last achievement unlocked

public:
	Achievements();							// constructor
	~Achievements();						// destructor

	void Unlock(int index);					// unlock achievement number index
	void Draw();							// draw unlocked achievements
	bool Waiting();							// achievements waiting to be drawn
	void MoveTo(float x, float y);			// move achievement box to position (x,y)
	Achievement & GetInfo();				// get achievement info
	bool GetUnlocked(int index);			// get unlocked state of achievement
	uint Total();							// return number of achievement points
	Achievement * List();					// return list of achievements
	Sprite * Icons();						// return achievement icons
};

/**********************************************************************************/

inline void Achievements::MoveTo(float x, float y)
{ achievementIcons->MoveTo(x,y); }

inline Achievement& Achievements::GetInfo()
{ return achievementList[lastIndex]; }

inline bool Achievements::GetUnlocked(int index)
{ return achievementList[index].unlocked; }

inline uint Achievements::Total()
{ return totalPoints; }

inline Achievement * Achievements::List()
{ return achievementList; }

inline Sprite * Achievements::Icons()
{ return achievementIcons; }

/**********************************************************************************/

#endif